<!--
 * @Author: liyaqi liyaqi0126@163.com
 * @Date: 2024-10-08 14:28:37
 * @LastEditors: liyaqi liyaqi0126@163.com
 * @LastEditTime: 2024-10-08 15:52:46
 * @FilePath: \FinancialLeasing-FG-FLCompany\src\views\processManage\contractFormulate\components\selectProject.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
    <div>

        <el-dialog title="选择项目" :visible="visible" width="1200px" append-to-body :close-on-click-modal="false" @close="handleCloseDialog">

            <el-form :model="queryParams" ref="queryParams" size="small" :inline="true">
                <el-form-item label="项目编号" prop="projectNumber">
                    <el-input v-model="queryParams.projectNumber" placeholder="请输入项目编号" clearable @keyup.enter.native="handleQuery"/>
                </el-form-item>
                <el-form-item label="业务类型" prop="businessType">
                    <el-input v-model="queryParams.businessType" placeholder="请输入业务类型" clearable @keyup.enter.native="handleQuery"/>
                </el-form-item>
                <el-form-item label="设备厂商" prop="deviceCompany">
                    <el-input v-model="queryParams.deviceCompany" placeholder="请输入设备厂商" clearable @keyup.enter.native="handleQuery"/>
                </el-form-item>
                <el-form-item label="客户类型" prop="customerType">
                    <el-input v-model="queryParams.customerType" placeholder="请输入客户类型" clearable @keyup.enter.native="handleQuery"/>
                </el-form-item>
                <el-form-item label="客户名称" prop="customerName">
                    <el-input v-model="queryParams.customerName" placeholder="请输入客户名称" clearable @keyup.enter.native="handleQuery"/>
                </el-form-item>
                <el-form-item label="代理商" prop="agent">
                    <el-input v-model="queryParams.agent" placeholder="请输入代理商" clearable @keyup.enter.native="handleQuery"/>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                    <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
                </el-form-item>
            </el-form>

            <el-table v-loading="loading" :data="dataList">
                <el-table-column label="项目编号" align="center" prop="projectNumber" :show-overflow-tooltip="true" min-width="150"/>
                <el-table-column label="客户名称" align="center" prop="customerName" :show-overflow-tooltip="true" min-width="150"/>
                <el-table-column label="代理商" align="center" prop="agent" :show-overflow-tooltip="true" min-width="150"/>
                <el-table-column label="合同金额" align="center" prop="contractAmount" :show-overflow-tooltip="true" min-width="150"/>
                <el-table-column label="立项时间" align="center" prop="projectApprovalTime" :show-overflow-tooltip="true" min-width="150"/>
                <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
                    <template slot-scope="scope">
                        <el-button
                            size="mini"
                            type="text"
                            icon="el-icon-check"
                            @click="handleSelect(scope.row)"
                            >选择
                        </el-button>
                    </template>
                </el-table-column>
            </el-table>

            <pagination
                v-show="total>0"
                :total="total"
                :page.sync="queryParams.pageNum"
                :limit.sync="queryParams.pageSize"
                @pagination="handleQuery"
            />
            
        </el-dialog>

    </div>
</template>

<script>
export default {
    name: 'selectProject',
    props: {
        visible: {
            type: Boolean,
            required: true,
            default: false
        },
    },

    data() {
        return {
            // 查询参数
            queryParams: {
                pageNum: 1,
                pageSize: 10,
                projectNumber: undefined,
                businessType: undefined,
                deviceCompany: undefined,
                customerType: undefined,
                customerName: undefined,
                agent: undefined
            },
            loading: false,
            // 总条数
            total: 0,
            dataList: [],

        }
    },

    methods: {
        getList() {
            
        },
        
        // 关闭弹窗
        handleCloseDialog() {
            // Object.assign(this.$data, this.$options.data());
            this.$emit('update:visible', false);
            
        },

        /** 搜索按钮操作 */
        handleQuery() {
            this.queryParams.pageNum = 1
            this.getList()
        },

        /** 重置按钮操作 */
        resetQuery() {
            this.resetForm('queryParams')
            this.handleQuery()
        },

        // 选择项目
        handleSelect(row) {
            this.$emit('update:visible', false);
            this.$emit('getProjectData')
        }


    },

}
</script>